package cn.com.nes.site.service.system.user.impl;

import cn.com.nes.mybatis.agent.system.entity.Company;
import cn.com.nes.mybatis.agent.system.mapper.CompanyMapper;
import cn.com.nes.mybatis.callcenter.mapper.CcUserMapper;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.entity.dto.call.InstallPeopleDto;
import cn.com.nes.site.entity.vo.user.GetInstallPeopleVo;
import cn.com.nes.site.service.system.user.BusinessUserService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BusinessUserServiceImpl implements BusinessUserService {

    @Resource
    private CcUserMapper userMapper;

    @Resource
    private CompanyMapper companyMapper;

    @Override
    public PageData getInstallPeoplePage(GetInstallPeopleVo vo) throws Exception {
        Company company = companyMapper.getCompanyUnDelete(vo.getOperateUserCompanyId());
        vo.setCompanyId(company.getCcCompanyId());
        Page<InstallPeopleDto> page = new Page<>(vo.getPageid(), vo.getPagesize());
        List<InstallPeopleDto> list = userMapper.getInstallPeoplePage(page, vo);
        return PageData.ok(page, list);
    }

}
